<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<link rel="stylesheet" href="${initParam.root}/css/board.css" type="text/css">
<meta charset="UTF-8">
<script type="text/javascript">
	$(document).ready(function() {
			$("#deleteDeal").click(	function() {
				if(confirm("삭제하시겠습니까?")==true){
			location.href = "${initParam.root}admin/deleteDeal.do?dealNumber=${requestScope.map.dealVo.dealNumber}";
			}
		});
		$("#tabs").tabs();
		
		$("#delImg").click(function(){
			if(confirm("해당글을 삭제하시겠습니까?")==false){
				return;
			}
		});
		
});//ready
</script>
<form id="show" action="${initParam.root}customer/addCart.do">
	<table class="registerMemberTable"  style="margin: 0 auto ; width: 600px"  >
		<tr>
			<td colspan="3" align="center">
				<h2>상품상세보기</h2> <input type="hidden" name="dealNumber"	value="${requestScope.map.dealVo.dealNumber}">
			</td>
		</tr>
		<tr>
			<td rowspan="8"><img	src="${initParam.root }upload/${requestScope.map.dealVo.dealImage }"
				width="300px" height="300px"></td>
		</tr>
		<tr>
			<td >상품명</td>
			<td><input type="text" name="dealTitle"
				value="${requestScope.map.dealVo.dealTitle}" readonly="readonly">
			</td>
		</tr>
		<tr>
			<td>카테고리</td>
			<td><input type="text" name="category"
				value="${requestScope.map.dealVo.category}" readonly="readonly">
			</td>
		</tr>
		<tr>
			<td>등록자</td>
			<td><input type="text" name="sellerId"
				value="${requestScope.map.dealVo.sellerId}" readonly="readonly">
			</td>
		</tr>
		<tr>
			<td>상품가격</td>
			<td><input type="text" name="dealPrice"
				value="${requestScope.map.dealVo.dealPrice}" readonly="readonly">
			</td>
		</tr>
		<c:choose>
		<c:when test="${requestScope.map.dealVo.dealCount!=0}">
		<tr>
			<td>남은수량</td>
			<td><input type="text" name="dealCount"
				value="${requestScope.map.dealVo.dealCount}" readonly="readonly">
			</td>
		</tr>
		<tr>
			<td>구입수량</td>
			<td><input type="number" name="cartCount" min="1" max="${requestScope.map.dealVo.dealCount }"
				value="0"></td>
		
		</tr>
		</c:when>
		<c:otherwise>
		<tr>
		<td rowspan="2" colspan="2">
		<img	src="${initParam.root }upload/soldout2.jpg" height="80px" width="200px"><br>
		</td>
		</tr>
		<tr><td></td></tr>
		</c:otherwise>
		</c:choose>
		<tr>
			<td>마감일</td>
			<td><input type="text" name="dealEndDate"
				value="${requestScope.map.dealVo.dealEndDate}" readonly="readonly">
			</td>
		</tr>
		<tr>
			<td colspan="2"><c:choose>
					<c:when test="${sessionScope.login.authNumber==1 && requestScope.map.dealVo.dealCount!=0}">
						<input type="hidden" name="customerId"	value="${sessionScope.login.customerId }">
						<input type="submit" value="장바구니담기">
					</c:when>
					<c:when test="${sessionScope.login.authNumber==11 }">
										<a href="${initParam.root}seller/update_Deal.do?dealNumber=${requestScope.map.dealVo.dealNumber}">
					<img	id="writeImg" src="${initParam.root }/img/modify_btn.jpg"></a>
					</c:when>
					<c:when test="${sessionScope.login.authNumber==100 }">
						<input type="button" id="deleteDeal" value="상품삭제">
					</c:when>
				</c:choose></td>
		</tr>
	</table>
</form>


<hr>



<body>
	<table class="content">
					<tr>
						<td><b>${requestScope.bvo.no }-${requestScope.map.bvo.title}
						 </b>
						</td>
					</tr>
					<tr>
						<td><font size="2">글쓴이: ${requestScope.map.bvo.writer }
							|	조회수: ${requestScope.map.bvo.viewCount } 
							|	${requestScope.map.bvo.writeDate}</font></td>
					</tr>
					<tr>
						<td><textarea cols="60" rows="10" name="content"
								readonly="readonly">${requestScope.map.bvo.content }</textarea></td>
								
					</tr>
					<tr>
						<td valign="middle">
						<a href="${initParam.root }common/showDealContents.do?dealNumber=${requestScope.map.dealVo.dealNumber}">
						<img src="${initParam.root}img/list_btn.jpg"></a> 
							<c:if test="${sessionScope.login.authNumber==1 && requestScope.map.bvo.writer==sessionScope.login.customerId}">
										<a href="updateView.do?dealNumber=${requestScope.map.dealVo.dealNumber}&no=${requestScope.map.bvo.no }">
										<img id="updateImg" src="${initParam.root}img/modify_btn.jpg"></a>
							</c:if>
								<c:if test="${sessionScope.login.authNumber==11 && requestScope.map.dealVo.sellerId==sessionScope.login.sellerId}">
									<c:if test="${sessionScope.login.sellerId eq requestScope.map.dealVo.sellerId}">
										<a href="${initParam.root}common/replyView.do?dealNumber=${requestScope.map.dealVo.dealNumber}&no=${requestScope.map.bvo.no }">
										<img src="${initParam.root}img/answer_btn.jpg"></a> 
									</c:if>
								</c:if>
								<c:if test="${sessionScope.login.authNumber==100 }">
									<a href="updateView.do?dealNumber=${requestScope.map.dealVo.dealNumber}&no=${requestScope.map.bvo.no }">
									<img id="updateImg" src="${initParam.root}img/modify_btn.jpg"></a>
									<a href="deleteBoard.do?dealNumber=${requestScope.map.dealVo.dealNumber}&no=${requestScope.map.bvo.no }">
									<img id="delImg" src="${initParam.root}img/delete_btn.jpg"></a>
								</c:if>
						</td>
					</tr>
				</table>
</body>
</html>